<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.yfg.wap.flight.dao.OrderQueryService"%>
<%@page import="com.yfg.wap.flight.reqRes.PayRequestResonseService"%>
<%@page import="com.yfg.wap.flight.common.GlobalData"%>
<%@page import="com.yfg.wap.flight.common.GetSequence"%>
<%@page import="com.yfg.wap.flight.dao.IncomExpenService"%>
<%@page import="com.yfg.wap.flight.entity.IncomExpenDetails"%>
<%@page import="com.yfg.wap.flight.common.CardPropertiesRead"%>
<%@page import="com.yfg.wap.flight.common.SignUtil"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="java.util.Date"%>
<%@page import="com.yfg.wap.flight.common.Tools"%>
<%@page import="java.util.TreeMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.yfg.wap.flight.entity.PlaneParentOrder"%>
<%@page import="com.yfg.wap.flight.common.DBhelper"%>
<%@ include file="head.jsp" %>
<%
	String orderNo = request.getParameter("sn");
	OrderQueryService queryService = new OrderQueryService();
	PlaneParentOrder parentOrder = (PlaneParentOrder)queryService.getOrder(orderNo);
	String scity = parentOrder.getScity();
	String ecity = parentOrder.getEcity();
	String voya = "";
	switch(parentOrder.getVoyagetype()){
	case 1:voya="单程";break;
	case 2:voya="往返";break;
	}
	String desc = "机票订单["+parentOrder.getSystemSn()+"],"+scity+"~"+ecity+",航程["+voya+"]";
	TreeMap treeMap = new TreeMap();
	treeMap.put("service_id","110001");
	treeMap.put("req_org_cd","jinri");
	treeMap.put("req_trans_tm",Tools.dateToString(new Date(),"yyyyMMddHHmmss"));
	treeMap.put("req_trans_seq",GetSequence.getDbSeqNum());
	treeMap.put("order_id",parentOrder.getSystemSn());
	treeMap.put("seller_id","jinri");
	treeMap.put("sub_order_flag","N");
	treeMap.put("sub_order_num","0");
	treeMap.put("order_desc",desc);
	treeMap.put("tot_trans_amt",parentOrder.getOrderTotal().multiply(new BigDecimal(100)).setScale(0)+"");
	treeMap.put("buyer_id",parentOrder.getMemberNum());
	treeMap.put("valid_date","0");
	treeMap.put("notify_url",CardPropertiesRead.readValue("notice_url"));
	treeMap.put("return_url",CardPropertiesRead.readValue("return_url"));
	String sign = SignUtil.sign(treeMap,CardPropertiesRead.readValue("card_key"));
	treeMap.put("sign",sign);
	treeMap.put("sign_type","MD5");
	
	PayRequestResonseService.insertSendRequest(treeMap);
%>
<html>
<body>
<div class="title">订单支付</div>
<ul class="radius_border box_form">
<li style="text-align: center;" class="price">
正在转向支付网关，请等待……
</li></ul>
<form id="pform" name="pform" action="<%=CardPropertiesRead.readValue("card_url") %>" method="post">
		<input type="hidden" name="service_id" value="<%=treeMap.get("service_id")%>"/>
    	<input type="hidden" name="req_org_cd" value="<%=treeMap.get("req_org_cd")%>"/>
    	<input type="hidden" name="req_trans_tm" value="<%=treeMap.get("req_trans_tm")%>"/>
    	<input type="hidden" name="req_trans_seq" value="<%=treeMap.get("req_trans_seq")%>"/>
    	<input type="hidden" name="order_id" value="<%=treeMap.get("order_id") %>"/>
    	<input type="hidden" name="seller_id" value="<%=treeMap.get("seller_id") %>"/>
    	<input type="hidden" name="sub_order_flag" value="<%=treeMap.get("sub_order_flag")%>"/>
    	<input type="hidden" name="sub_order_num" value="<%=treeMap.get("sub_order_num")%>"/>
    	<input type="hidden" name="order_desc" value="<%=treeMap.get("order_desc")%>"/>
    	<input type="hidden" name="tot_trans_amt" value="<%=treeMap.get("tot_trans_amt")%>"/>
    	<input type="hidden" name="buyer_id" value="<%=treeMap.get("buyer_id") %>"/>
    	<input type="hidden" name="valid_date" value="<%=treeMap.get("valid_date") %>"/>
    	<input type="hidden" name="notify_url" value="<%=treeMap.get("notify_url") %>"/>
    	<input type="hidden" name="return_url" value="<%=treeMap.get("return_url") %>"/>
    	<input type="hidden" name="sign" value="<%=treeMap.get("sign") %>"/>
    	<input type="hidden" name="sign_type" value="<%=treeMap.get("sign_type") %>"/></form>
<script type="text/javascript">
	document.getElementById('pform').submit();
</script>
</body>
</html>